import request from '@/utils/request'
const baseUrl = '/cz-rentbox/api/v1/bills' // 业务账单

// http://47.122.3.254:9999/cz-system/api/v1
// 查询租箱账单列表
export const getRentBillListByOrderId = (data: any) => {
  return request({
    url: baseUrl + '/getRentBillListByOrderId',
    method: 'POST',
    data:data
  })
}

/*
 列表
# POST {{baseUrl}}/page
*/
export const getTableList = (data: any) => {
  return request({
    url: baseUrl + '/page',
    method: 'POST',
    data:data
  })
}
/*
 列表
# POST {{baseUrl}}/page
*/
export const getTableListOrderId = (data: any) => {
  return request({
    url: baseUrl + '/getCallbackBillListByOrderId                                   ',
    method: 'POST',
    data:data
  })
}
/*
 列表
# POST {{baseUrl}}/page
*/
export const getBillSumAmount = (data: any) => {
  return request({
    url: baseUrl + '/getBillSumAmount',
    method: 'POST',
    data:data
  })
}
/*
根据id查询账单业务费用明细详情
*/
export const getBillBusinessDetailsById = (data: any) => {
  return request({
    url: baseUrl + '/getBillBusinessDetailsById',
    method: 'POST',
    data:data
  })
}
  // 编辑
export const updateBill = (data: any) => {
    return request({
      url: baseUrl + '/updateBill',
      method: 'PUT',
      data:data
    })
  }
    // 批量更新账单状态
export const updateBillStatus = (data: any) => {
    return request({
      url: baseUrl + '/updateBillStatus',
      method: 'PUT',
      data:data
    })
  }
  // 查询费用明细金额总计
export const getFeeDetailsListAmountSum = (data: any) => {
  return request({
    url: baseUrl + '/getFeeDetailsListAmountSum',
    method: 'POST',
    data:data
  })
}
//批量删除
export const deleteIds = (ids: any) => {
  return request({
    url: baseUrl,
    method: 'DELETE',
    data:ids
  })
}
// 新增费用业务明细
export const addBill = (data: any) => {
  return request({
    url: baseUrl + '/addBill',
    method: 'POST',
    data:data
  })
}
// 核销账单金额
export const writeOffBill = (data: any) => {
  return request({
    url: baseUrl + '/writeOffBill',
    method: 'POST',
    data:data
  })
}

/*
 列表
# POST {{baseUrl}}/page
*/
export const billsList = (data: any) => {
  return request({
    url: baseUrl + '/list',
    method: 'POST',
    data:data
  })
}
/*
 列表
# POST {{baseUrl}}/page
*/
export const getBillListAmount = (data: any) => {
  return request({
    url: baseUrl + '/getBillListAmount',
    method: 'POST',
    data:data
  })
}
/*
 核销记录撤销
# POST {{baseUrl}}/page
*/
export const writeOffBillRevoke = (data: any) => {
  return request({
    url: baseUrl + '/writeOffBillRevoke',
    method: 'POST',
    data:data
  })
}
  // 导出
export const exportBill = (data: any) => {
  return request({
    responseType: 'blob',
    url: baseUrl + '/exportBill',
    method: 'POST',
    data:data
  })
}


// 财务分析

// ###
// # 账单利润趋势:折线图
// # 过滤条件:dataType:数据类型: 3-日 5-月份 10-季度 15-年份

  export const billProfitCountDate = (data: any) => {
    return request({
      url: baseUrl + '/billProfitCountDate',
      method: 'POST',
      data:data
    })
  }
  // # 客户利润趋势:柱状图 billProfitProportionCountCompany
  export const billProfitCountCompany = (data: any) => {
    return request({
      url: baseUrl + '/billProfitCountCompany',
      method: 'POST',
      data:data
    })
  }
  // # 账单客户利润趋势:占比图
  export const billProfitProportionCountCompany = (data: any) => {
    return request({
      url: baseUrl + '/billProfitProportionCountCompany',
      method: 'POST',
      data:data
    })
  }